The present invention relates to a semiconductor device having two types of power supply terminals, a main power supply terminal which is coupled to a main power supply and a backup power supply terminal which is coupled to a backup power supply. The invention also relates to a technique that is effectively applied to, e.g., a microcontroller including a clock circuit.
Techniques exist that, through the use of a backup power supply in addition to a main power supply, assure a continued operation of an electronic device by using the backup power supply even in case of interruption or loss of the main power supply. For example, Patent Document 1 describes a technique in which, when a main power supply has interrupted or its output voltage has dropped, a power supply switchover unit is actuated to supply power from a backup power supply to a volatile memory and a clock circuit 3. Also, Patent Document 2 describes a technique that, when switching from an oscillation circuit powered by a backup power supply to an oscillation circuit powered by a main power supply to generate a clock which is supplied to a clocking circuit, utilizes a delay circuit to wait until stabilization of oscillation of the oscillation circuit powered by the main power supply. This can avoid the occurrence of a clocking error and malfunction of a clock circuit, when switching from the oscillation circuit powered by the backup power supply to the oscillation circuit powered by the main power supply.